package com.yunhe.option.service.base;

import com.yunhe.common.exception.ArgumentErrorException;
import com.yunhe.common.exception.ObjectNotFoundException;
import com.yunhe.common.exception.UniqueConstraintsException;
import com.yunhe.option.domain.base.Item;
import org.springframework.transaction.annotation.Transactional;

/**
 * @ClassName ItemService
 * @Description TODO
 * @Author HeTao
 * @Date 2021/2/26 14:55
 * @Version 1.0
 **/
public interface ItemService {
    Iterable<Item> findByEnumId(Long id);

    @Transactional(rollbackFor = Exception.class, transactionManager = "transactionManager")
    Item createItem(Long enumId, Long parentId, Item item) throws UniqueConstraintsException, ArgumentErrorException, ObjectNotFoundException;

    @Transactional(rollbackFor = Exception.class, transactionManager = "transactionManager")
    Item updateItem(Item item) throws ObjectNotFoundException, UniqueConstraintsException, ArgumentErrorException;

    @Transactional(rollbackFor = Exception.class, transactionManager = "transactionManager")
    void delete(Long id) throws ArgumentErrorException;

    Item getItemById(Long id) throws ObjectNotFoundException;

    Iterable<Item> getItemByEnumName(String enumName);

    Iterable<Item> getChildItemsById(Long id);

    Iterable<Item> getAllItems(String enumName);

    Iterable<Item> getItemByItemCodeAndEnumName(String name);


}
